import { post } from '../http/index'
import { get } from '../http/index'
//注册
export const SignUp = (user) => post(`/user/register`, user)

//登录
export const loginIn = (user) => post(`/user/login`, user)

// 获取商品列表
export const select_item_list = () => get('/item/list')
// 获取商品详情
export const select_item_details = (iid) => get(`/item/details?iid=${iid}`)
// 获取购物车列表
export const select_shopcar_list = (uid) => get(`/shopCart/list?uid=${uid}`)
//加入购物车
export const add_to_car = (car) => post(`/shopCart/add`, car)
//删除购物车项
export const delete_by_cid = (cid) => get(`/shopCart/delete?cid=${cid}`)

//单独下单
export const pay = (car) => post(`/shopCart/pay`, car)
export const clear_shop_cart = (carList) =>
  post(`/shopCart/clearShopCart`, carList)

// 获取订单列表
export const select_order_list = (uid, pageIndex, pageSize) =>
  get(`/order/list?uid=${uid}&pageIndex=${pageIndex}&pageSize=${pageSize}`)

export const updatePassword = (user) => post(`/user/updatePassword`, user)

export const updateUserInfo = (user) => post(`/user/updateUserInfo`, user)

export const add_orders = (order) => post(`/order/add`, order)
